
package org.bim.view.drag.design.config;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * SwaggerProperties
 *
 * @author Chill
 */
@Getter
@Setter
@ConfigurationProperties("swagger")
public class SwaggerProperties {
    private static final String ACCESS_TOKEN_KEY = "access_token";

    /**
     * 是否开启，默认关闭，需要开启的话，需要设置成true
     */
    private Boolean enable = false;
    /**
     * swagger会解析的包路径,多个用逗号隔开
     **/
    private String[] basePackage = new String[]{"org.bim.view"};
    /**
     * swagger会解析的url规则
     **/
    private List<String> basePath = new ArrayList<>();
    /**
     * 在basePath基础上需要排除的url规则
     **/
    private List<String> excludePath = new ArrayList<>();
    /**
     * 标题
     **/
    private String title = "BIM VIEW API";
    /**
     * 描述
     **/
    private String description = "BIM VIEW 接口文档系统";
    /**
     * 版本
     **/
    private String version = "2.5.0";
    /**
     * 许可证
     **/
    private String license = "";
    /**
     * 许可证URL
     **/
    private String licenseUrl = "";
    /**
     * 服务条款URL
     **/
    private String termsOfServiceUrl = "";

    /**
     * host信息
     **/
    private String host = "";
    /**
     * 联系人信息SwaggerDisplayConfig
     */
    private Contact contact = new Contact();
    /**
     * Token列表
     */
    private Set<String> headerTokenKeys = new HashSet<>();
    /**
     * query参数 列表
     */
    private Set<String> queryTokenKeys = new HashSet<>();



    public Set<String> getQueryTokenKeys() {
        if (queryTokenKeys != null) {
            queryTokenKeys.add(ACCESS_TOKEN_KEY);
        }
        return queryTokenKeys;
    }


    @Setter
    @Getter
    @NoArgsConstructor
    public static class Contact {

        /**
         * 联系人
         **/
        private String name = "BIM VIEW";
        /**
         * 联系人url
         **/
        private String url = "";
        /**
         * 联系人email
         **/
        private String email = "2358009937@qq.com";

    }


}
